package com.lbj.googleplay.googleplay100.ui.holder;

import android.view.View;

public abstract class BaseHolder<T>  {

    private final View mRootView;//一个item的根布局
    private T data;         //数据

    public BaseHolder(){
         mRootView = initView();
         mRootView.setTag(this);
    }
    //初始化布局,子类实现
    public abstract View initView();

    //返回根布局对象
    public View getmRootView(){

        return mRootView;
    }

    //设置当前item的数据
    public void  setData(T data){
        this.data = data;
        refreshView(this.data);
    }
    //获取当前item的数据
    public T getData() {
        return data;
    }

    //根据数据刷新界面
    public abstract void refreshView(T data);
}

